package com.snake.springboot.authority.service.aspect;

import com.snake.springboot.authority.api.service.AuthUsedService;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 *
 */
@Aspect
@Component
public class RoleChangeAspectj {

    private AuthUsedService authUsedService;
    @Autowired
    public RoleChangeAspectj(AuthUsedService authUsedService) {
        this.authUsedService = authUsedService;
    }
    /**
     * 添加关系
     */
    @After(value = "execution(* com.snake.springboot.authority.api.service.AuthMenuService.addMenu(..))")
    public void refresh1(){
        authUsedService.refreshRoleCache();
    }

    @After(value = "execution(* com.snake.springboot.authority.api.service.AuthMenuService.removeMenu(..))")
    public void refresh2(){
        authUsedService.refreshRoleCache();
    }

    @After(value = "execution(* com.snake.springboot.authority.api.service.AuthMenuService.modifyMenu(..))")
    public void refresh3(){
        authUsedService.refreshRoleCache();
    }

    @After(value = "execution(* com.snake.springboot.authority.api.service.AuthRoleMenuService.saveRoleMenuRef(..))")
    public void refresh4(){
        authUsedService.refreshRoleCache();
    }

    @After(value = "execution(* com.snake.springboot.authority.api.service.AuthInterfaceService.addInterface(..))")
    public void refresh5(){
        authUsedService.refreshRoleCache();
    }

    @After(value = "execution(* com.snake.springboot.authority.api.service.AuthInterfaceService.modifyInterface(..))")
    public void refresh6(){
        authUsedService.refreshRoleCache();
    }

    @After(value = "execution(* com.snake.springboot.authority.api.service.AuthInterfaceService.removeInterface(..))")
    public void refresh7(){
        authUsedService.refreshRoleCache();
    }

    @After(value = "execution(* com.snake.springboot.authority.service.impl.AuthStrategyMenuServiceImpl.saveStrategyMenuRef(..))")
    public void refresh8(){
        authUsedService.refreshRoleCache();
    }







}
